<template>
  <div>
    <Echart
      :options="options"
      height="240px"
      width="470px"
    />
  </div>
</template>

<script>
import Echart from '../../../common/echart'

export default {
  components: {
    Echart
  },
  // 这里是预留给你传数据的
  props: {
    cdata: {
      type: Object,
      default: () => ({})
    }
  },
  data() {
    return {
      options: {}
    }
  },
  watch: {
    cdata: {
      handler() {
        const color = ['#FB497C', '#2FC25B', '#FF7714', '#FFF440', '#008AFF', '#03BDA0']
        this.options = {
          color: color,
          tooltip: {
            trigger: 'item'
          },
          legend: {
            show: false
          },
          series: [
            {
              type: 'pie',
              roseType: 'radius',
              radius: ['30%', '60%'],
              data: [
                {
                  value: 220,
                  name: '有色行业'
                },
                {
                  value: 120,
                  name: '危化'
                },
                {
                  value: 189,
                  name: '其他行业'
                },
                {
                  value: 189,
                  name: '轻工行业'
                },
                {
                  value: 189,
                  name: '机械行业'
                },
                {
                  value: 189,
                  name: '商贸行业'
                }
              ],
              emphasis: {
                itemStyle: {
                  shadowBlur: 10,
                  shadowOffsetX: 0,
                  shadowColor: 'rgba(0,0,0,0.5)'
                }
              }
            }
          ]
        }
      },
      immediate: true,
      deep: true
    }
  }
}
</script>
